package ca.shojaei.mini_sat;

import java.io.*;
import java.util.*;

public class ReadFile {

	public static Vector<int[]> getState(String fileName)
	{
		
		Vector<int[]> result = new Vector<int[]>();
		
		File file = new File(fileName);
		
		FileInputStream fis = null;

		DataInputStream dis = null;
		BufferedReader reader = null;
		try{
			fis = new FileInputStream(file);
			dis = new DataInputStream(fis);
			reader = new BufferedReader(new InputStreamReader(dis));
			String line;
			while((line = reader.readLine()) != null)
			{
				StringTokenizer st = new StringTokenizer(line);	
				if(st.countTokens() != 2) throw new Exception("Wrong format file");
				int i = 0;
				int[] temp  = new int[2];
				while(st.hasMoreElements())
				{
					
					temp[i] = Integer.parseInt(st.nextToken());
					i++;
					
				}
				result.add(temp);
			}
			
			dis.close();
			
		}catch (Exception e)
		{
			System.out.println("Cannot read from the file" + e.getMessage());
		}
		
		return result;
		
	}
	
}
